 <title>information内容管理</title>
{% extends "base.html" %}
{% block content %}
 
<style type="text/css">
    h1 {
    color:red; 
    font-size:30px;
    text-align: center;
    }
</style>
<script>
function myApi(p1)
{
    var p1=p1
    if (p1 == "ai"){
        document.getElementById("api").action="api_create";
    }
    else if (p1 == "bi"){
    document.getElementById("api").action="api_update";
    }
    else if (p1 == "ci"){
    document.getElementById("api").action="api_delete";
    }
    else{
    }
    document.getElementById("api").submit();
}
</script> 
</head>

<body>
<div>
<form class="form-horizontal" role="form" action="api_input" method="POST" id="api" name="api">
    <div class="form-group">
        <label for="firstname" class="col-sm-2 control-label">名字</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="apiname" id="inapiname" 
                   placeholder="请输入名字">
        </div>
        </div>
    <div class="form-group">
        <label for="lastname" class="col-sm-2 control-label">地址</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="apiurl" id="inapiurl" 
                   placeholder="请输入地址">
        </div>
    </div>
    <div class="form-group">
        <label for="lastname" class="col-sm-2 control-label">原地址</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="apioldurl" id="inapioldurl" 
                  placeholder="原地址" disabled="true"　readOnly="true" />
        </div>
    </div>    

<input name="myInput" id="ai" type="button" value="新增" onclick="myApi(id);"/>
<input name="myInput" id="bi" type="button" value="更新" onclick="myApi(id);"/>
<input name="myInput" id="ci" type="button" value="删除" onclick="myApi(id);"/>
</form>
<select name="carlist" from="api" onchange="document.getElementById('inapiname').value=this.value">
    {% for item in data %}
     <option value="{{ item.name }}">{{ item.name }}</option>
    {% endfor %} 
</select>
</div>
{% endblock %} 